package <%=packageName%>.task;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;


/**
 * 定时任务的使用
 **/
@Component
@Slf4j
public class <%=pascalCase(name)%>Task {

    @Scheduled(cron="0 * *  * * ? ")   //每分钟执行一次
    public void execute(){
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置日期格式
        log.info("run task at:{}" , df.format(new Date()));
    }
}